import React, { Component } from 'react'
import ComMid from './ComMid'

export default class ComBig extends Component {
    constructor() {
        super();
        this.state = {
            age: 18,
            isShow: true
        }
    }
    changeAge() {
        this.setState({
            age: this.state.age + 1
        })
    }
    // 显示隐藏的切换
    toggle() {
        this.setState({
            isShow: !this.state.isShow
        })
    }
    render() {
        return (
            <div>
                <button onClick={() => this.changeAge()}>{this.state.age}</button>
                <button onClick={() => this.toggle()}>霰弹枪</button>
                <hr></hr>
                {this.state.isShow ? <ComMid age={this.state.age}></ComMid> : null}
                <hr></hr>
            </div>
        )
    }
}
